#ifndef QLIB_LIBRARYMODEL_H
#define QLIB_LIBRARYMODEL_H

#include <QObject>

class QedaLibrary;
class QedaComponent;

class LibraryModel : public QObject
{
    Q_OBJECT
public:
    explicit LibraryModel(QObject *parent = 0);
    ~LibraryModel();
    
    bool containsLibrary(const QString &filePath);
    QedaLibrary *createLibrary(const QString &libName, const QString &filePath);
    QedaLibrary *loadLibrary(const QString &filePath);
    void removeLibrary(QedaLibrary *library);
    const QList<QedaLibrary*> &libraries() const { return m_libraries; }

signals:
    void libraryAdded(QedaLibrary *lib);
    void libraryUpdated(QedaLibrary *lib);
    void libraryRemoved(QedaLibrary *lib);
    void componentsAdded(QedaLibrary *lib, const QList<QedaComponent*> &components);
    void componentUpdated(QedaComponent *component);
    void componentRemoved(QedaComponent *component);

public slots:
private:
    QedaLibrary *newLibrary();
    void deleteLibrary(QedaLibrary *lib);

private:
    QList<QedaLibrary*>  m_libraries;
};

#endif // QLIB_LIBRARYMODEL_H
